{include file="public/head"}

<body>
<div id="wrapper">

    <div class="gray-bg dashbard-1">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <form class="form-horizontal m-t" id="commentForm">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理账号：</label>
                                    <div class="col-sm-8">
                                        <input id="username" name="username" maxlength="50" type="text" class="form-control" required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">登录密码：</label>
                                    <div class="col-sm-8">
                                        <input id="password" name="password" maxlength="50" type="password" class="form-control" required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理姓名：</label>
                                    <div class="col-sm-8">
                                        <input id="name" name="name" maxlength="32" type="text" class="form-control"  required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理手机：</label>
                                    <div class="col-sm-8">
                                        <input id="phone" name="phone" maxlength="11" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">所属角色：</label>
                                    <div class="col-sm-8">
                                        <select class="form-control m-b" id="role">
                                            {volist name="Role" id="v"}
                                                <option value="{$v.id}">{$v.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-3">
                                        <button class="btn btn-primary" type="submit">确认添加</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
{include file="public/footer"}
<script>
    $('form').submit(function (e) {
        e.preventDefault();
        $.ajax({
            type:"post",
            url:"{:url('Admin/AdminAdd')}",
            data: $("form").serialize(),
            dataType:"json",
            success:function(data){
                if(data.status == 1){
                    layer.msg(data.message,{icon: 6,time:1500},function () {
                        window.top.location.reload();
                    });
                }else{
                    layer.msg(data.message,{icon: 5,time:1500});
                }
            }
        })
    })
</script>
</body>

</html>
